#include<stdio.h>
#include<stdlib.h>

int main(int argc,char **argv)
{
    int ch;
    int count = 0;
    if (argc < 3)
    {
        fprintf(stderr,"Usage: %s source_file dest_file\n",argv[0]);
        exit(1);
    }

    FILE *fps;
    FILE *fpd;
    fps = fopen(argv[1],"r");
    if (fps == NULL)
    {
        perror("fopen()");
        exit(1);
    }
    fpd = fopen(argv[2],"w");
    if (fpd == NULL)
    {
        fclose(fps);
        perror("fopen()");
        exit(1);
    }
    while (1)
    {
        ch = fgetc(fps);
        if(ch == EOF)
            break;
        fputc(ch,fpd);
        count++;
    }

    fprintf(stdout,"file size : %d\n",count);    
    fclose(fps);
    fclose(fpd);
}